package com.xuzao.developer.enums;

import com.xuzao.developer.utils.IntegerUtil;
import lombok.Getter;

/**
 * @author xuzao
 * @description
 * @date 2019-08-22 15:29
 */
public enum RoleTypeEnum {
    MANAGER(0,"管理员"),
    USER(1,"普通用户");
    @Getter
    private int code;
    @Getter
    private String desc;

     RoleTypeEnum(int code,String desc){
        this.code = code;
        this.desc = desc;
    }

    public static RoleTypeEnum valueOf(Integer code){
         if (null == code){
             return null;
         }
        for (RoleTypeEnum value : RoleTypeEnum.values()) {
            if(IntegerUtil.equalTo(value.getCode(),code)){
                return value;
            }
        }
        return null;
    }

}
